# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=py3-icalendar
_pyname=icalendar
pkgver=5.0.11
pkgrel=0
pkgdesc="icalendar parser library for Python"
url="https://github.com/collective/icalendar"
arch="noarch"
license="BSD-2-Clause"
depends="py3-dateutil py3-tz"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-hypothesis tzdata"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/i/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --system-site-packages testenv
	testenv/bin/python3 -m installer dist/*.whl
	# Test fails on arm7 pipeline for some reason but isn't reproducible locally.
	testenv/bin/python3 -m pytest -v "src/$_pyname/tests" \
		--deselect 'src/icalendar/tests/test_unit_cal.py::test_calendars_with_same_subcomponents_in_different_order_are_equal[issue_526_calendar_with_events-issue_526_calendar_with_shuffeled_events]'
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/*.whl

	cd "$pkgdir"
	rm -r usr/lib/python*/site-packages/icalendar/tests/
}

sha512sums="
ac567ac761fde076d5895a3353fff4de9244847689d4f5366d918223a49f1ffa87063f8bb55b7458092369482868e40d2c9925ea7d95e77feeaf3d9711a5b7d9  icalendar-5.0.11.tar.gz
"
